package com.demo.testWork.base;

import com.demo.core.BaseApiCore;
import com.demo.core.BaseVerifyCore;
import com.demo.enums.RequestContentTypeEnum;
import io.qameta.allure.Step;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class LoginPage extends BaseApiCore {

    /**
     * @Title: xxxxx
     * @Description: Invoke /xxxxx API via http post
     */
    @Step("Get xxxxx, Route: /xxxxx")
    public BaseVerifyCore getXxxxxx(Map<String, Object> requestParam) {
        // Declare necessary variables
        StringBuffer requestUrl = new StringBuffer();

        // header
        Map<String, Object> header = new HashMap<>();
        header.put("Content-Type", RequestContentTypeEnum.URLENCODED.getContentType());
        header.put("Authorization", basicAuth);

        // Set Request URL
        requestUrl.append("xxxxx");

        return new BaseVerifyCore(formPost(requestUrl.toString(), header, requestParam));
    }
}
